import request from '@/utils/request';
// 商品列表
export async function queryRule(params?: Object) {
  return request('/api/goods/list', {
    method: 'GET',
    params,
  });
}

export async function createRule(data?: Object) {
  return request('/api/goods', {
    method: 'POST',
    data,
  });
}

export async function updateRule(id: string, data?: Object) {
  return request(`/api/goods/${id}`, {
    method: 'PUT',
    data,
  });
}

export async function detailRule(params?: Object) {
  return request('/api/goods', {
    method: 'GET',
    params,
  });
}

export async function galleryRule(id: string) {
  return request(`/api/goods/gallery/${id}`, {
    method: 'DELETE',
  });
}

export async function removeRule(id: string) {
  return request(`/api/goods/goods/${id}`, {
    method: 'DELETE',
  });
}

export async function attrAllRule(params?: Object) {
  return request('/api/goods/attr/all', {
    method: 'GET',
    params,
  });
}

export async function createValRule(id: string, data?: Object) {
  return request(`/api/goods/attrval/${id}`, {
    method: 'POST',
    data,
  });
}
